package com.bjesc_b2c.app.appraiset.mvp.presenter.impl;

import android.content.Context;

import com.bjesc_b2c.app.appraiset.mvp.model.LoginModel;
import com.bjesc_b2c.app.appraiset.mvp.model.impl.LoginModelImpl;
import com.bjesc_b2c.app.appraiset.mvp.presenter.LoginPresenter;
import com.bjesc_b2c.app.appraiset.mvp.view.LoginView;

import master_bean.LoginBean;

/**
 * Created by lenovo on 2017/2/27.
 */

public class LoginPersenterImpl implements LoginPresenter, LoginModelImpl.CallBack {
    private LoginView view;
    private LoginModel model;

    public LoginPersenterImpl(LoginView view) {
        this.view = view;
        model = new LoginModelImpl(this);
    }

    /**
     * 调用登录接口
     * @param userName
     * @param password
     */
    @Override
    public void requestLogin(String userName, String password) {
        model.requestLogin((Context) view,userName,password);
    }

    @Override
    public void callback(LoginBean bean) {
        if(bean!=null){
            view.login();
        }
    }
}
